{% extends "base.html" %}
{% block content %}
    <div class="page-header">
        <h3>修改文档：{{ document.title }} <small><a href="{{ url_for("admin.manage_document",catalog_id=catalog_id) }}">&lt;&lt;返回分类列表</a></small></h3>
    </div>
    <form method="POST" action="">
        <table>
            <tr>
                <td><input type="text" class="input-xxlarge" name="title" value="{{ document.title }}"></td>
                <td>
                    <select name="catalog" id="catalog">
                        <option value="{{ catalog.id }}">{{ catalog.name }}</option>
                        {% for cat in catalog.all_childs%}
                            <option value="{{ cat.id }}">{% for i in range(cat.level) %}&nbsp;&nbsp;&nbsp;&nbsp;{% endfor %}{{ cat.name }} </option>
                        {% endfor %}
                    </select>
                </td>
            </tr>
            <tr>
                <td><textarea name="content" rows="15" style="width: 100%">{{ txt }}</textarea></td>
                <td>

                </td>
            </tr>
            <tr>
                <td><button class="btn btn-large btn-primary" type="submit">修改</button></td>
                <td></td>
            </tr>
        </table>

    </form>

{% endblock %}
{% block endscript %}
    <script type="text/javascript">
        $(function(){
            {% if selected_catalog %}
                $("#catalog").val('{{ selected_catalog }}');
            {% endif %}
        });
    </script>
{% endblock %}